from selenium import webdriver
from  selenium.webdriver.common.by import By
import time
d = webdriver.Chrome()
d.get("https://www.baidu.com/")
time.sleep(1)
search = d.find_element(By.ID,'kw')
search.send_keys('武汉黄鹤楼')
time.sleep(2)

search.clear()
time.sleep(2)

search.send_keys('中国名胜古迹')
button = d.find_element(By.ID,'su')
button.click()
time.sleep(2)






# 定位到hao123
# a标签 文本链接标签
# herf 属性对应的值 就是跳转的网址
# 文本链接标签就用 By.LINK_TEXT
arel = d.find_element(By.LINK_TEXT,'hao')
arel.click()
time.sleep(2)
# 局部的文件链接定位
arel = d.find_element(By.PARTIAL_LINK_TEXT,'hao')
arel.click()
time.sleep(5)



d.quit()